package deng.log4j.examples;

import java.io.PrintStream;

/**
 * Hello bean that greet name to a print stream.
 * 
 * @author Zemian Deng
 *
 */
public class Hello {

	// ========== Fields
	protected String name;
	protected PrintStream printStream;

	// ========== Getters and Setters
	public void setName(String name) {
		this.name = name;
	}
	public void setPrintStream(PrintStream printStream) {
		this.printStream = printStream;
	}

	// ========== Constructors

	// ========== Internal Instance Methods

	// ========== Public Instance Methods
	public void init(String[] args) {
		printStream = System.out;
		if (args.length == 1) {
			name = args[0];
		} else {
			name = "World";
		}
	}
	
	public void run() {
		printStream.println("Hello " + name);
	}
	
}
